#!/usr/bin/env ruby
require 'textblock_handler'

$tblocks = []
$twords = []
class Article
include TextBlockHandler

  def parseit(file)
    
  end
end

class Tblock
  def initialize
    @nf_rect = NfRect.new
  end
  attr_accessor :nf_rect, :p, :s, :h, :avgh, :classification, :format, :word
  def save
    $tblocks << self
  end
end

class Word
  def initialize
    @nf_rect = NfRect.new
  end
  attr_accessor :nf_rect, :text
  def save
    $twords << self
  end
end

class NfRect
  attr_accessor :x, :y, :width, :height
end

def main

article = Article.new
article.new_parser
article.parse("/Users/mshirley/school/USC/dresearch/blocks/Azzaroni_1995_671_78-blocks.xml")
  $tblocks.each do |tb|
    puts "x=#{tb.nf_rect.x}"
    puts "y=#{tb.nf_rect.y}"
    puts "width=#{tb.nf_rect.width}"
    puts "height=#{tb.nf_rect.height}"
  end
  $twords.each do |tb|
    puts "x=#{tb.nf_rect.x}"
    puts "y=#{tb.nf_rect.y}"
    puts "width=#{tb.nf_rect.width}"
    puts "height=#{tb.nf_rect.height}"
  end
end

main
